// File Paths (文件路径) 示例
program FilePaths;

{$mode objfpc}{$H+}

uses
  SysUtils;

var
  TestPath: string;
  FullPath: string;

begin
  WriteLn('=== Pascal 文件路径操作示例 ===');
  WriteLn;
  
  // 测试路径
  TestPath := 'example\test\data.txt';
  WriteLn('测试路径: ', TestPath);
  WriteLn;
  
  // 提取文件名
  WriteLn('1. 提取文件名:');
  WriteLn('   ExtractFileName: ', ExtractFileName(TestPath));
  WriteLn;
  
  // 提取文件扩展名
  WriteLn('2. 提取文件扩展名:');
  WriteLn('   ExtractFileExt: ', ExtractFileExt(TestPath));
  WriteLn;
  
  // 提取路径部分
  WriteLn('3. 提取路径部分:');
  WriteLn('   ExtractFilePath: ', ExtractFilePath(TestPath));
  WriteLn;
  
  // 更改文件扩展名
  WriteLn('4. 更改文件扩展名:');
  WriteLn('   ChangeFileExt: ', ChangeFileExt(TestPath, '.bak'));
  WriteLn;
  
  // 路径分隔符处理
  WriteLn('5. 路径分隔符处理:');
  WriteLn('   IncludeTrailingPathDelimiter: ', IncludeTrailingPathDelimiter(ExtractFilePath(TestPath)));
  WriteLn('   ExcludeTrailingPathDelimiter: ', ExcludeTrailingPathDelimiter('example\'));
  WriteLn;
  
  // 获取绝对路径
  WriteLn('6. 获取绝对路径:');
  FullPath := ExpandFileName(TestPath);
  WriteLn('   ExpandFileName: ', FullPath);
  WriteLn;
  
  // 获取相对路径
  WriteLn('7. 获取相对路径:');
  WriteLn('   ExtractRelativePath: ', ExtractRelativePath(GetCurrentDir(), FullPath));
  WriteLn;
  
  // 不同操作系统路径示例
  WriteLn('8. 跨平台路径处理:');
  WriteLn('   Windows 路径: ', 'C:\Users\Public\Documents');
  WriteLn('   Unix 路径: ', '/home/user/documents');
  WriteLn('   路径分隔符 (PathDelim): ', PathDelim);
  WriteLn('   搜索路径分隔符 (SearchPathSepChar): ', SearchPathSepChar);
  WriteLn;
  
  WriteLn('文件路径操作示例完成。');
  ReadLn;
end.